package com.ray.controller;

import com.ray.utils.Websocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.WeakHashMap;

@Controller
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private Websocket websocket;

    @RequestMapping("getOrderList")
    public String getOrderList(){

        return "order_list";
    }

    @RequestMapping("createOrder")
    @ResponseBody
    public String createOrder(){
        //创建订单

        //给商家平台发生websocket消息
        websocket.sendMessage("您有新的订单");
        return "创建订单成功";
    }
}
